Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the length property won't be *accidentally* accessed on a DecodeStream-instance #12365

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

For these streams, compared to Stream and ChunkedStream, there's no well defined concept of length and consequently no length getter.[1] However, attempting to access the non-existent length won't currently error, but just return undefined, which could thus easily lead to bugs elsewhere in the code-base.


[1] However, note that all stream implementations have an isEmpty getter which can be used instead.

… a `DecodeStream`-instance

For these streams, compared to `Stream` and `ChunkedStream`, there's no well defined concept of length and consequently no `length` getter.[1] However, attempting to access the non-existent `length` won't currently error, but just return `undefined`, which could thus easily lead to bugs elsewhere in the code-base.

---
[1] However, note that *all* stream implementations have an `isEmpty` getter which can be used instead.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/aa801bcb51e8a73/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/96b7ba68ba0be29/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/aa801bcb51e8a73/output.txt

Total script time: 27.53 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/aa801bcb51e8a73/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/96b7ba68ba0be29/output.txt

Total script time: 29.46 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/96b7ba68ba0be29/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit dfebe7b into mozilla:master Sep 11, 2020
@timvandermeij
Copy link
Contributor

Thank you for fixing this potential problem! (I recall this was a point of attention during the AcroForm/XFA work.)

@Snuffleupagus Snuffleupagus deleted the forbid-DecodeStream.length branch September 11, 2020 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants